<template>

		<view>
			<im-navBar
				@rightActionSelectedFu="toChatUserInfoFu"
				:navbarText="inChatUser.nickName"
				backAction
				rightAction
				rightIcon="more-fill"
				selectedRightIcon="more-fill"
			></im-navBar>
			<tui-divider height="10rpx"></tui-divider>
			<!-- #ifndef H5 -->
			<!--解决手机端 状态栏问题-->
			<view class="bg-grey" style="height: 50rpx;width: 100%;"></view>
			<!-- #endif -->
			<view class="im-msg-box list-view animation-scale-up padding-lg">
					<im-msgBox :chatId="inChatUser.id"></im-msgBox>
			</view>
			<!-- 发送消息的input -->
			<im-inChat-foot-input :inChatUserId="inChatUser.id" :inChatUser="inChatUser">
			</im-inChat-foot-input>
		</view>
	
</template>

<script>
	import ImEnum from '../../sdk/enums/index.js'
export default {
	name: 'InChat',
	data() {
		return {
			// <!-- 	[{
			// 	id:1,
			// 	name:'波多野溪子',
			// 	nickName:'波多野溪子',
			// 	avatar:'https://cdn.quasar.dev/img/avatar.png',
			// 	type:ImEnum.OtherEnum.USER_TYPE.USER,
			// 	unReadCount :1,
			// 	lastChatTime:'10:22',
			// 	lastChatContent:"你好啊，傻逼",
			// }] -->
			inChatUser: {},
		};
	},
	methods: {
		navBarRightActionSelectedFu(obj) {
			console.log('------' + JSON.stringify(obj));
		},
		toChatUserInfoFu(){
			uni.navigateTo({
				url:"../contacts/friend/friendInfo"
			})
		},
	},
	onLoad: function(option) {
		const userInfo = JSON.parse(decodeURIComponent(option.userInfo));
		let temp = ''
		if (userInfo.type === ImEnum.OtherEnum.USER_TYPE.USER) {
			temp = 'user-' + userInfo.id;
		} else if (userInfo.type === ImEnum.OtherEnum.USER_TYPE.GROUP) {
			temp = 'group-' + userInfo.id;
		} else {
			temp = 'chatRoom-' + userInfo.id;
		}
		userInfo.id = temp
		this.inChatUser = userInfo 
	},
};
</script>

<style scoped>
.im-msg-box {
	padding-bottom: 120rpx;
	padding-top: 100rpx;
}
</style>
